#include "start_freertos.h"

#include "FreeRTOS.h"
#include "task.h"

#include "stm32f10x.h"
#include "led01.h"
#include "systick.h"
#include "key.h"
#include "heart.h"
#include "gather.h"
#include "execute.h"
#include "stdio.h"
#include "blueteeth.h"
#include "config.h"

TaskHandle_t start_task_handler;
extern QueueHandle_t  configMsgHandle;


void start_task(void * pvParameters){
    /* 进入临界区 */
    taskENTER_CRITICAL(); 
	
	  configMsgHandle = xQueueCreate(100,sizeof(char *));
    //初始任务相关的资源:比如led,key其他的东西
    heartTaskInit();
	  gather_Init();
	  executeTaskInit();
	  bluetooth_init();
	  configTaskInit();
    //创建各种任务
	  //1.心跳模块
    createHeartTask();
	  createBluetoothTask();
	  createConfigTask();
	  createGatherTask();
	  createExecuteTask();
	  vTaskDelete(NULL); 
    /* 退出临界区 */
    taskEXIT_CRITICAL();


}


//创建start_task
void freertos_start(){
    xTaskCreate(start_task,"start_task",128,NULL,2,&start_task_handler);
    vTaskStartScheduler();

}